Skip to content

chore: optimise post analytics query#3256

Merged
vpol merged 2 commits intomainfrom
feat_optimise_query
Nov 4, 2025
Merged

chore: optimise post analytics query#3256
vpol merged 2 commits intomainfrom
feat_optimise_query

Conversation

@vpol
Copy link
Copy Markdown
Contributor

@vpol vpol commented Nov 4, 2025

No description provided.

Signed-off-by: Viktor Poluksht <viktor@daily.dev>
Signed-off-by: Viktor Poluksht <viktor@daily.dev>
@pulumi
Copy link
Copy Markdown

pulumi Bot commented Nov 4, 2025

🍹 The Update (preview) for dailydotdev/api/prod (at 8f8a6da) was successful.

Resource Changes

    Name                                                   Type                           Operation
~   vpc-native-clean-zombie-user-companies-cron            kubernetes:batch/v1:CronJob    update
~   vpc-native-update-highlighted-views-cron               kubernetes:batch/v1:CronJob    update
~   vpc-native-update-views-cron                           kubernetes:batch/v1:CronJob    update
+   vpc-native-api-db-migration-89d0270c                   kubernetes:batch/v1:Job        create
~   vpc-native-generic-referral-reminder-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-stale-user-transactions-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-check-analytics-report-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tags-str-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-generate-search-invites-cron                kubernetes:batch/v1:CronJob    update
~   vpc-native-sync-subscription-with-cio-cron             kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-images-cron                    kubernetes:batch/v1:CronJob    update
+   vpc-native-api-clickhouse-migration-89d0270c           kubernetes:batch/v1:Job        create
~   vpc-native-calculate-top-readers-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-update-current-streak-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-update-trending-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-update-source-tag-view-cron                 kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-cron                    kubernetes:batch/v1:CronJob    update
~   vpc-native-daily-digest-cron                           kubernetes:batch/v1:CronJob    update
~   vpc-native-private-deployment                          kubernetes:apps/v1:Deployment  update
-   vpc-native-api-clickhouse-migration-e895cb1d           kubernetes:batch/v1:Job        delete
~   vpc-native-personalized-digest-deployment              kubernetes:apps/v1:Deployment  update
~   vpc-native-deployment                                  kubernetes:apps/v1:Deployment  update
~   vpc-native-temporal-deployment                         kubernetes:apps/v1:Deployment  update
~   vpc-native-update-source-public-threshold-cron         kubernetes:batch/v1:CronJob    update
~   vpc-native-post-analytics-clickhouse-cron              kubernetes:batch/v1:CronJob    update
-   vpc-native-api-db-migration-e895cb1d                   kubernetes:batch/v1:Job        delete
~   vpc-native-hourly-notification-cron                    kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-gifted-plus-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-validate-active-users-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-ws-deployment                               kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-zombie-users-cron                     kubernetes:batch/v1:CronJob    update
~   vpc-native-bg-deployment                               kubernetes:apps/v1:Deployment  update
~   vpc-native-post-analytics-history-day-clickhouse-cron  kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tag-recommendations-cron             kubernetes:batch/v1:CronJob    update

WHERE (event_name IN ('share post', 'bookmark post', 'impression', 'share to squad', 'click', 'go to link'))
AND (target_id IS NOT NULL)
AND (target_type = 'post')
AND (server_timestamp > '2025-10-08 13:00:00')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this hard coded date?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was there and I haven't changed it.

idea of specifying the date/timestamp is to cut the time when MV begins working, so you can manually backfill the data before this timestamp.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've only added AND (target_type = 'post')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah really hate you can't see actual diffs on these migrations :(

@vpol vpol merged commit 1d99717 into main Nov 4, 2025
18 checks passed
@vpol vpol deleted the feat_optimise_query branch November 4, 2025 13:28
vpol added a commit that referenced this pull request Nov 4, 2025
vpol added a commit that referenced this pull request Nov 4, 2025
Signed-off-by: Viktor Poluksht <viktor@daily.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants